package com.wxapp.sale.service.controller.client;
import com.wxapp.common.constant.base.IBaseController;
import com.wxapp.common.constant.pojo.vm.ResultVm;
import com.wxapp.common.constant.pojo.vo.UserVo;
import com.wxapp.common.core.annotation.User;
import com.wxapp.sale.api.pojo.vm.shopCart.PShopCartListVm;
import com.wxapp.sale.api.pojo.vo.shopCart.QShopCartAddVo;
import com.wxapp.sale.service.service.ShopCartService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Description 购物车管理
 * @author lgl
 * DateTime  2024/2/1 9:26
 * Modified By
 */
@RestController
@Tag(name = "购物车管理")
@RequestMapping("client/shop/cart")
@RequiredArgsConstructor
public class ShopCartController extends IBaseController {
    private final ShopCartService shopCartService;

    @GetMapping("list")
    @Operation(summary = "获取购物车")
    public ResultVm<List<PShopCartListVm>> list(@Schema(hidden = true) @User UserVo userVo) {
        return shopCartService.list(userVo);
    }

    @PostMapping("add")
    @Operation(summary = "获取购物车")
    public ResultVm<String> add(@Schema(hidden = true) @User UserVo userVo, @RequestBody QShopCartAddVo qShopCartAddVo) {
        return shopCartService.add(userVo, qShopCartAddVo);
    }
   
    @DeleteMapping("delete")
    @Operation(summary = "获取购物车")
    public ResultVm<String> delete(@Schema(hidden = true) @User UserVo userVo, @RequestBody List<String> id) {
        return shopCartService.delete(userVo, id);
    }
}
